package com.xianyun.site.iblog.support.command;

import com.alibaba.cola.dto.Response;
import com.xianyun.site.support.dto.SmsSendCmd;
import com.xianyun.site.iblog.gatewayimpl.SmsGatewayImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 发送短信
 * @author mac_zyj
 */
@Component
public class SmsSendCmdExo {
    @Autowired
    private SmsGatewayImpl smsGateway;

    public Response execute(SmsSendCmd cmd) {
        //The flow of usecase is defined here.
        //The core ability should be implemented in Domain. or sink to Domain gradually
        cmd.initSms();
        return smsGateway.sendSmsMessage(cmd.getReceiveCmd().getSmsMessage());
    }
}
